<?php

function getEndDate($inEvent){								//WORKING
	settype($inEvent,"integer");
	
	$sql = sprintf("SELECT enddate FROM events WHERE ID = %s;",$inEvent);
	$res = sendQ($sql);
	$resA = mysql_fetch_array($res);
	$enddate = $resA['enddate'];
	
	return $enddate;
	
}



function getKey($id,$wl){
	settype($id,"integer");
	
	$key = base64_encode(rand()*rand());
	$sql = "";
	if($wl){
		$sql = sprintf("SELECT * FROM event_%s_waitlist WHERE mkey = '%s';", $id, $key);
	}else{
		$sql = sprintf("SELECT * FROM event_%s WHERE mkey = '%s';", $id, $key);
	}
	$res = sendQ($sql);
	$resA = mysql_fetch_array($res);
	$resA = $resA['mkey'];
	
	if($resA == $key){
		$key = getKey($id,$wl);
	}
	
	return $key;
	
	
	
}
?>